package com.dongshan.myregistry.conf;

import com.dongshan.myregistry.cluster.Cluster;
import com.dongshan.myregistry.health.CheckHealth;
import com.dongshan.myregistry.health.MyCheckHealth;
import com.dongshan.myregistry.service.RegisterService;
import com.dongshan.myregistry.service.impl.MyRegistryService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * 装配beans
 */
@Configuration
public class MyRegisterConf {

    @Bean
    public RegisterService RegisterServer(){
        return new MyRegistryService();
    }

    @Bean(initMethod = "start",destroyMethod = "stop")
    public CheckHealth checkHealth(RegisterService registerService){
        return new MyCheckHealth(registerService);
    }


    @Bean(initMethod = "init")
    public Cluster cluster(MyRegisterConfigProperties myRegisterConfigProperties){
        return new Cluster(myRegisterConfigProperties);
    }
}
